﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

namespace Hont.HyperWigglePackage.Editor
{
    public partial class HyperWiggleEditorView
    {
        const float TIMELINE_FRAME_WIDTH = 17;
        const float TIMELINE_FRAME_HEIGHT = 20;


        void DrawTimelineFrameGUI(Rect rect)
        {
            var originX = rect.x + MID_SPACING;

            for (int i = 0; i < mTimelineVO.EndFrame; i++)
            {
                var x = originX + i * (TIMELINE_FRAME_WIDTH + SMALL_SPACING);

                var frameRect = new Rect(
                     x
                    , rect.y + 6
                    , TIMELINE_FRAME_WIDTH
                    , TIMELINE_FRAME_HEIGHT);

                var textOffset = 2;
                var frameTipRect = new Rect(
                     x + textOffset
                    , rect.y + 24
                    , TIMELINE_FRAME_WIDTH
                    , TIMELINE_FRAME_HEIGHT - 5);

                var oldColor = GUI.color;
                GUI.color = mTimelineVO.ColorsArray[i];
                GUI.Box(frameRect, "");
                GUI.color = oldColor;

                GUI.Label(frameTipRect, i.ToString());
            }
        }
    }
}
